package com.atguigu.spzx.product.service.impl;

import com.atguigu.spzx.common.utils.BeanUtils;
import com.atguigu.spzx.product.entity.Category;
import com.atguigu.spzx.product.manager.CategoryCacheManager;
import com.atguigu.spzx.product.mapper.CategoryMapper;
import com.atguigu.spzx.product.service.CategoryService;
import com.atguigu.spzx.product.vo.CategoryTreeQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * CategoryServiceImpl
 * </p>
 *
 * @author flyduck
 * @since 2023/11/3
 */
@Service
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private CategoryCacheManager categoryCacheManager;

    /**
     * 获取分类树形数据
     * key = category::all
     * @return
     */
    @Override
    public List<CategoryTreeQueryVo> findCategoryTree() {
        return categoryCacheManager.findCategoryTree();
    }
}
